print('Find the gcd and lcm of m and n:')

m = int(input('Input m: '))
n = int(input('Input n: '))

if (m > n):
    m, n = n, m

for lcm in range(n, n*m+1, m):
    if lcm % m == 0 and lcm % n == 0:
        print('The lcm is: ', lcm)
        break

for gcd in range(m, 0, -1):
    if m % gcd == 0 and n % gcd == 0:
        print('The gcd is: ', gcd)
        break
